# -*- coding: UTF-8 -*-

def consumer():
    r = ''
    while True:
        n = yield r
        if not n:
            print "数据为None"
            continue
        print("【consumer】接受数据为：%s" % n)
        r = '200 OK'

def produce(c):
    c.send(None)
    n = 0
    while n < 5:
        n = n + 1
        print("【produce】生产数据：%s" % n)
        r = c.send(n)
        print("【produce】消费者返回数据为：%s" % r)
    c.close()

c = consumer()
produce(c)
